<?php

namespace IDock\Insurance\AMIC\Response;

use IDock\Http\Response;
use IDock\Insurance\AMIC\Response\AllAMICResponse;
use IDock\Printer\PolicyPaymentPrinter;

class PolicyPaymentResponse extends AllAMICResponse
{

    /**
     * @var PolicyPaymentPrinter $printer
     */
    public $printer = PolicyPaymentPrinter::class;

    public function printerInit(): Response
    {
        $data = $this->getBody()['Body']['payBase'];
        $this->printer->payUrl = $data['payUrl'] ?? '';
        if(empty($this->printer->payUrl)){
            $this->setError("获取支付链接失败：");
            return $this;
        }
        return $this;
    }
}
